package com.gameley.dmgtpf.kernel.controller;

import com.gameley.dmgtpf.common.core.aspect.MyDoneTime;
import com.gameley.dmgtpf.common.utils.PubEnvUtil;
import com.gameley.dmgtpf.kernel.service.MobileService;
import com.gameley.dmgtpf.kernel.service.RegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
public class DmgtPfController
{
    
    @Autowired
    private MobileService mobileService;
    
    @Autowired
    private RegionService regionService;
    
    @MyDoneTime(param = "DmgtPfController.getProvince")
    @ResponseBody
    @RequestMapping("/getProvince")
    public String getProvince(HttpServletRequest request, HttpServletResponse response)
    {
        return PubEnvUtil.getSuccessMsg(regionService.getProvinceList());
    }
    
    @MyDoneTime(param = "DmgtPfController.getCity")
    @ResponseBody
    @RequestMapping("/getCity")
    public String getCity(HttpServletRequest request, HttpServletResponse response, String[] tags, String provinceIds[])
    {
        return PubEnvUtil.getSuccessMsg(regionService.getCityList(tags, provinceIds));
    }
    
    @MyDoneTime(param = "DmgtPfController.getMobileBrands")
    @ResponseBody
    @RequestMapping("/getMobileBrands")
    public String getMobileBrands(HttpServletRequest request, HttpServletResponse response)
    {
        return PubEnvUtil.getSuccessMsg(mobileService.getMobileBrands());
    }
    
    @MyDoneTime(param = "DmgtPfController.getSeries")
    @ResponseBody
    @RequestMapping("/getSeries")
    public String getSeries(HttpServletRequest request, HttpServletResponse response, String[] names, String prcess[])
    {
        return PubEnvUtil.getSuccessMsg(mobileService.getSeries(names, prcess));
    }
    
}
